import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-binding',
  templateUrl: './binding.component.html',
  styleUrls: ['./binding.component.scss']
})
export class BindingComponent implements OnInit {
  //单向绑定
  individualModelValue: string = "我是单向绑定，页面输入无法整改我";
  //双向绑定
  twoWay: string = "我是双向绑定，页面输入及后端赋值均可更改我";
  //局部变量--按钮触发时赋值
  btnStr: string = "";

  btnOptions:any = {
    width:"90px",
    text:"事件绑定"
  };
  constructor() { }

  ngOnInit() {
  }

  btnClick() {
    if (this.btnStr === "") {
      this.btnStr = "我是通过点击事件绑定的值";
    } else {
      this.btnStr = "";
    }
  }
}
